package com.ljw.spring.annotation.ext;

import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @FileName MyAnnotationListener
 * @Description TODO
 * @Author ljw
 * @Date 2021/2/4 3:37
 * @Version 1.0
 */
@Component
public class MyAnnotationListener {

    @EventListener
    public void listener1(MyApplicationEvent event) {
        System.out.println("注解监听器1:" + event);
    }

    @EventListener
    public void listener2(MyApplicationEvent event) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("注解监听器2:" + event);
    }
}
